package com.heima.admin.controller;

import com.heima.admin.dto.LoginDto;
import com.heima.admin.service.IAdUserService;
import com.heima.common.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: itheima
 * @create: 2022-06-30 10:26
 */
@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private IAdUserService adUserService;


    /**
     * 管理员登录接口
     * @param dto 登录参数
     * @return {user:{},token:"jwt令牌"}
     */
    @PostMapping("/in")
    public ResponseResult login(@RequestBody LoginDto dto){
        return adUserService.login(dto);
    }
}
